﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AboutControl.aspx.cs" Inherits="Portal.Web.Admin.Setting.AboutControl" %>

<ul class="lan-ul">
    <li>
        <label>
            载入语言:</label>
        <select id="setting-about-culture" name="Culture" editable="false" currentvalue="<%=Model.Culture %>">
        </select>
    </li>
</ul>
<div class="jqeasyui-form">
    <form id="form-setting-about" action="" method="POST">
        <fieldset>
            <legend></legend>
            <p>
                <label>
                    公司简介:</label>
                <span class="span-textarea">
                    <textarea name="CompanyProfile" id="setting-companyProfile" style="width: 700px; height: 400px;"><%=Model.CompanyProfile %></textarea></span>
            </p>
            <p>
                <label>
                    公司详细介绍:</label>
                <span class="span-textarea">
                    <textarea name="About" id="setting-about" style="width: 700px; height: 400px;"><%=Model.About %></textarea></span>
            </p>
            <p>
                <label>
                </label>
                <input type="button" id="btn-setting-about-submit" value="保存" />
            </p>
        </fieldset>
    </form>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        var adminSettingCommpanyPostUrl = 'Setting/AboutSave.aspx?culture=<%=culture%>';
        $('#setting-about-culture').combobox({
            data: CultureComboboxJsonData,
            valueField: 'id',
            textField: 'text',
            onSelect: function (record) {
                $('#form-setting-about').form('load', 'Setting/SettingJson.aspx?' + 'culture=' + record.id);
                adminSettingCommpanyPostUrl = 'Setting/AboutSave.aspx?culture=' + record.id;
            }
        });
        $('#form-setting-about').form({
            onBeforeLoad: function () { }, onLoadSuccess: function () {
                selfAbout.html($('#setting-about').val());
                selfcompanyProfile.html($('#setting-companyProfile').val());
            }
        });
        var selfAbout = window.KindEditor.create('#setting-about', {
            uploadJson: 'Setting/UploadSettingJson.aspx',
            fileManagerJson: 'Setting/FileManagerSettingJson.aspx',
            allowFileManager: true, afterCreate: function () {
                selfAbout = this;

            }
        });
        var selfcompanyProfile = window.KindEditor.create('#setting-companyProfile', {
            uploadJson: 'Setting/UploadSettingJson.aspx',
            fileManagerJson: 'Setting/FileManagerSettingJson.aspx',
            allowFileManager: true, afterCreate: function () {
                selfcompanyProfile = this;
            }
        });
        $('#setting-about-culture').combobox("setValue", $('#setting-about-culture').attr('currentvalue'));
        $('#btn-setting-about-submit').click(function () {
            selfAbout.sync();
            selfcompanyProfile.sync();
            $.ajax({
                type: "POST",
                url: adminSettingCommpanyPostUrl,
                data: $("#form-setting-about").serialize(),
                dataType: 'json',
                success: function (data) {
                    $.messager.alert('提示', data.message, "info");
                },
                error: function () {
                    $.messager.alert('错误', '修改失败！', "error");
                }
            });
        });
    });
</script>
